package com.lin.chapter12.dynamic;

import com.lin.chapter12.force.GamePlayer;
import com.lin.chapter12.force.IGamePlayer;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.time.LocalDateTime;

public class Client {
	public static void main(String[] args) {
		IGamePlayer player = new GamePlayer("张三");
		InvocationHandler handler = new GamePlayH(player);
		IGamePlayer proxy = (IGamePlayer) Proxy.newProxyInstance(player.getClass().getClassLoader(), new Class[]{IGamePlayer.class}, handler);

		System.out.println("开始时间是： " + LocalDateTime.now());
		proxy.login("zhangshan", "password");
		proxy.killBoss();
		proxy.upgrade();
		System.out.println("结束时间是：" + LocalDateTime.now());
	}
}
